package com.ai.sb.controller;
import com.ai.sb.model.SbRuleTitleWx;
import com.ai.sb.service.SbRuleTitleWxService;
import com.ai.sb.util.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* Created by CodeGenerator on 2018/06/21.
*/
@RestController
@RequestMapping("/sb/rule/title/wx")
public class SbRuleTitleWxController {
    @Resource
    private SbRuleTitleWxService sbRuleTitleWxService;

    @ApiOperation(value = "活动规则查询" ,notes = "返回结果")
    @GetMapping("/titleWx")
    public Result addPrizeRecord() {
        List<SbRuleTitleWx> ruleTitles = sbRuleTitleWxService.selRule();
        return Result.success(ruleTitles);
    }

    @ApiOperation(value = "查询活动过期情况", notes = "返回结果")
    @GetMapping("/selOverdueWx")
    public Result selOverdue(){
        Map rs = sbRuleTitleWxService.isOverdue();
        if(!(boolean)rs.get("code")){
            return Result.fail((String) rs.get("msg"));
        }
        return Result.success(null);
    }
}
